home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / What's New? / Development Kits / Mac OS / USB DDK 1.4.6f4 / Examples / USBModem / ModemDriver.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-25  |  2.9 KB  |  105 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        ModemDriver.h
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Version:    xxx put version here xxx
  7.  
  8.     Copyright:    © 1999-2000 by Apple Computer, Inc., all rights reserved.
  9.  
  10. */
  11.  
  12. #ifndef    _MODEMDRIVER_
  13. #define    _MODEMDRIVER_
  14.  
  15. typedef struct{
  16.     USBPB                         pb;
  17.     UInt8                         *errorString;
  18.     UInt16                         interfacenum;
  19.     USBDeviceRef                 deviceRef;
  20.     USBPipeRef                     interrupt;
  21.     USBPipeRef                     bulkIn;
  22.     USBPipeRef                     bulkOut;
  23.     USBDeviceDescriptorPtr        deviceDescriptor;
  24.     UInt8                        modemStatus;
  25.     UInt8                        lineStatus;
  26.     UInt8                         onError;
  27.     UInt8                         retries;
  28.     Boolean                        DTRClose;            // true means don't negate DTR
  29.     UInt16                        modemUSBStatus;        // Modem and line status USB
  30.     UInt16                        lineState;            // Current USB line state
  31.     LineParms                    Line_Settings;        // USB current line settings    
  32.     } serPB;
  33.  
  34. enum{
  35.     kReset                     = 0,
  36.     kCommConfig             = 1,
  37.     kSetConfig                 = 2,
  38.     kGetCommInterface         = 3,
  39.     kSetCommInterface        = 4,
  40.     kConfigureCommInterface = 5,
  41.     kGetInterruptEndpoint     = 6,
  42.     kDataConfig             = 7,
  43.     kGetDataInterface         = 8,
  44.     kConfigureDataInterface = 9,
  45.     kGetBulkOutEndpoint     = 10,
  46.     kGetBulkInEndpoint         = 11,
  47.     kConfigDone             = 12,
  48.     kInstallDrvr            = 13,
  49.     
  50.     kEndpointStall             = 1,
  51.     kStallDone                 = 2,
  52.     
  53.     kResetDevice             = 1,
  54.     kResetDone                = 2,
  55.     
  56.     kAvailableStatus         = 'okok'
  57.     };
  58.  
  59. /********************************************************************************************/
  60. //
  61. //    Prototypes
  62. //
  63. /********************************************************************************************/
  64.  
  65. void         USBStatus(UInt32 level, USBDeviceRef ref, void *pointer, UInt32 value);
  66. static         Boolean immediateError(OSStatus err);
  67. static void ConfigurationHandler(USBPB *pb);
  68. static void ResetInterruptPB(USBPB *pb);
  69. static void interruptCompletion(USBPB *pb);
  70. static void StartStatusMonitor(USBPipeRef interruptPipe);
  71. static void syncCompletion(USBPB *pb);
  72. Boolean     TimeoutPrevRequest(void);
  73. Boolean     TimeoutStallRequest(void);
  74. Boolean     TimeoutDelayRequest(void);
  75. void         USBSetBaudRate(UInt32 baudRate);
  76. void         USBSetLineCoding(LineParms Line_Coding);
  77. void         USBSetControlLineState(void);
  78. void         USBSetDTRState(Boolean state);
  79. void         USBSetRTSState(Boolean state);
  80. void         USBSendBreak(Boolean state);
  81. void         USBSetCloseDTR(void);
  82. UInt8         USBGetDCDValue(void);
  83. OSStatus     modemDriverEntry(USBDeviceRef device, USBDeviceDescriptor *desc, UInt32 bPower);
  84. static void InitializePB(USBPB *pb, USBDeviceRef ref, USBCompletion handler);
  85. void         readCompletion(USBPB *pb);
  86. void         USBStartReadPolling();
  87. void         USBStopReadPolling(void);
  88. void         writeCompletion(USBPB *pb);
  89. OSStatus     USBSerialWrite(IOParam *pb);
  90. void         KillUSBIO(void);
  91. void         InitLineCoding(LineParms Line_Coding);
  92. void         DoDelay(void);
  93. static void delayHandler(USBPB *pb);
  94. void         ClearDevice(void);
  95. static void stallHandler(USBPB *pb);
  96. void         ResetDevice(void);
  97. static void ResetHandler(USBPB *pb);
  98. UInt8         Asciify(UInt8 i);
  99.  
  100. #if ((DebugOn > 0) && (LogOn > 0))
  101. void         USBLogData(UInt8 Dir, UInt32 Count, UInt8 *buf);
  102. #endif
  103.  
  104. #endif
  105.